package com.itheima.ZuoYe09;

import java.util.Calendar;

/*
请编程，计算并打印当前系统时间的“100天后”及“100天前”的日期及星期几？
 */
public class Demo {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        c.add(Calendar.DAY_OF_MONTH,100);

        int year = c.get(Calendar.YEAR);
        int mouth = c.get(Calendar.MONTH);
        int day = c.get(Calendar.DAY_OF_MONTH);
        int week = c.get(Calendar.DAY_OF_WEEK);

        Calendar c1 = Calendar.getInstance();
        c1.add(Calendar.DAY_OF_MONTH,-100);

        int year1 = c1.get(Calendar.YEAR);
        int mouth1 = c1.get(Calendar.MONTH);
        int day1 = c1.get(Calendar.DAY_OF_MONTH);
        int week1 = c1.get(Calendar.DAY_OF_WEEK);
        System.out.println("100天前是："+year1+"年"+mouth1+"月"+day1+"日"+getweek(week1));
        System.out.println("100天后是："+year+"年"+mouth+"月"+day+"日"+getweek(week));
    }
    public static String getweek(int w){
        String [] weekArray = {"星期日","星期二","星期三","星期四","星期五","星期六","星期一"};
        return weekArray[w-1];
    }
}
